import layoutHeaderAside from '@/layout/header-aside'

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
const _import = require('@/libs/util.import.' + process.env.NODE_ENV)

const meta = { auth: true }

export default {
  path: '/system',
  name: 'system',
  meta,
  redirect: { name: 'system-index' },
  component: layoutHeaderAside,
  children: (pre => [
    {
      path: 'user',
      name: `${pre}user`,
      component: _import('system/user/index'),
      meta: {
        ...meta,
        title: '用户列表'
      }
    },
    {
      path: 'role',
      name: `${pre}role`,
      component: _import('system/role/index'),
      meta: {
        ...meta,
        title: '角色列表'
      }
    },
    {
      path: 'permission',
      name: `${pre}permission`,
      component: _import('system/permission/index'),
      meta: {
        ...meta,
        title: '功能列表'
      }
    },
    {
      path: 'department',
      name: `${pre}department`,
      component: _import('system/department/index'),
      props: true,
      meta: {
        ...meta,
        title: '组织架构'
      }
    },
    {
      path: 'dictionary',
      name: `${pre}dictionary`,
      component: _import('system/dictionary/index'),
      props: true,
      meta: {
        ...meta,
        title: '字典管理'
      }
    },
    {
      path: 'blackList',
      name: `${pre}blackList`,
      component: _import('system/blackList/index'),
      props: true,
      meta: {
        ...meta,
        title: '黑名单设置'
      }
    },
    {
      path: 'logControl',
      name: `${pre}logControl`,
      component: _import('system/logControl/index'),
      props: true,
      meta: {
        ...meta,
        title: '日志输出设置'
      }
    },
    {
      path: 'sysImageFavorite',
      name: `${pre}sysImageFavorite`,
      component: _import('system/sysImageFavorite/index'),
      props: true,
      meta: {
        ...meta,
        title: '图片收藏夹'
      }
    }
  ])('system-')
}
